<template>
    <div>
        <el-breadcrumb
            separator-class="el-icon-arrow-right"
            class="breadcrumb-base"
            style="line-height: 30px;"
        >
            <el-breadcrumb-item>
                <!--:to="{ path: '/application' }"-->
                <i class="el-icon-s-home"></i>
                <span>上海申康</span>
            </el-breadcrumb-item>
        </el-breadcrumb>

        <div class="main-container">
            <!-- <div class="pathological-data-Push">
        <span style="color:#8F8F8F;">病理数据推送:</span>
        <el-date-picker
          v-model="pathologicalDataPushDate"
          value-format="yyyy-MM-dd"
          type="date"
          size="mini"
          placeholder="选择日期">
        </el-date-picker>
        <el-button type="primary" size="mini" :loading="false" style="margin-left:20px;">推送</el-button>
      </div> -->
            <div class="push-detail">
                <span style="color:#8F8F8F;">数据推送详情:</span>
                <el-date-picker
                    v-model="pushDetailDate"
                    value-format="yyyy-MM-dd"
                    type="date"
                    size="mini"
                    placeholder="选择日期"
                >
                </el-date-picker>
                <el-button
                    type="primary"
                    size="mini"
                    :loading="false"
                    style="margin-left:20px;"
                    @click='getDataList'
                >查询</el-button>
            </div>
            <el-table
                :data="tableData"
                border
                :cell-style="{'text-align':'center'}"
                :header-cell-style="{
          'background-color': '#E6E9EF',
          'color':'#777C7C',
          'font-weight':'400',
          'font-size' : '15px',
          'border-right': '1px solid #ffffff',
          'text-align':'center'}"
                size="mini"
                style="width: 50%;margin-top: 20px;"
            >
                <el-table-column
                    prop="pushType"
                    label="推送类型"
                >
                </el-table-column>
                <el-table-column
                    prop="totalAmountOfPush"
                    label="总推送量"
                >
                </el-table-column>
                <el-table-column
                    prop="pushSuccessNumber"
                    label="推送成功"
                >
                </el-table-column>
                <el-table-column
                    prop="pushFailNumber"
                    label="推送失败"
                >
                </el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <!-- <el-button @click="reUpload(scope.row)" type="text" size="small">一键重传</el-button> -->
                        <el-button
                            @click="toView(scope.row)"
                            type="text"
                            size="small"
                        >查看详情</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
import { Message } from 'element-ui';
export default {
    name: 'shenKangIndex',
    data() {
        return {
            pushDetailDate: '',
            pathologicalDataPushDate: '',
            tableData: [],
        };
    },
    mounted() {
        var now = new Date();
        var year = now.getFullYear(); //得到年份
        var month = now.getMonth() + 1; //得到月份
        var date = now.getDate() - 1; //得到日期
        this.pushDetailDate = year + '-' + month + '-' + date;
        console.log('this.pushDetailDate', this.pushDetailDate);
        this.getDataList();
    },
    methods: {
        //重传
        reUpload(row) {
            setTimeout(function () {
                Message.success('重传成功');
            }, 1000);
        },
        //查看
        toView(row) {
            if (row.pushType == '患者信息') {
                this.$router.push('/medicalGroup/patient-information');
            } else if (row.pushType == '报告信息') {
                this.$router.push('/medicalGroup/Check-information');
            } else if (row.pushType == '报告文档') {
                this.$router.push('/medicalGroup/check-document');
            }
        },
        //通过日期获取数据列表
        getDataList() {
            const that = this;
            this.$axios({
                method: 'GET',
                url: '/PROXY-Remote/shenkang/data/summary',
                params: {
                    date: that.pushDetailDate,
                },
            })
                .then(function (res) {
                    if (res.data.code !== 200) {
                        throw new Error(res.data);
                    } else {
                        if (res.data.data.data == '') {
                            Message.info('暂无数据');
                            that.tableData = [];
                        } else {
                            console.log(res.data);
                            console.log(res.data.data.data);
                            that.tableData = res.data.data.data;
                        }
                    }
                })
                .catch(function (err) {});
        },
    },
};
</script>

<style scoped>
.pathological-data-Push {
    margin-top: 20px;
}
.push-detail {
    margin-top: 20px;
}
</style>
